<template>
  <div>
    <div class="most-expected">
      <p class="title">近期最受期待</p>
      <div class="most-expected-list">
        <div v-for="item in dailist" :key="item.id">
          <!-- 添加跳转到 内容页的链接 -->
          <!-- <router-link :to="'/item/' + item.id"> -->
          <div class="poster default-img-bg">
            <img :src="item.img" />
            <span class="wish-bg"></span>
            <span class="wish">
              <span class="wish-num">
                {{ item.wish }}
                <span>人想看</span>
              </span>
            </span>
            <div class="toggle-wish">
              <span></span>
            </div>
          </div>
          <div class="name line-ellipsis">
            {{ item.nm }}
          </div>
          <div class="date">
            {{ item.comingTitle }}
          </div>
        </div>
      </div>
    </div>
    <div>
      <ul>
        <li v-for="(value, key) in daiyingList" :key="key">
          <div class="vv">{{ key }}</div>
          <ul>
            <li v-for="item in value" :key="item.id">
              <div class="vv_one">
                  <div class="vv_two">
                        <img :src="item.img" alt="">
                  </div>
                  <div class="vv_three" >
                       <p class=" line-ellipsis"> {{ item.nm }}</p>
                   <p> {{ item.wish }}
                       <span>人想看</span>
                   </p>
                   <p class="vv_four line-ellipsis">主演: {{ item.star }}</p>
                   <p class="vv_five"> {{ item.showInfo }}</p>
                  </div>
                <div class="right">
                <div class="active1" v-show="!item.preShow">预售</div>
                <div class="active" v-show="item.preShow">想看</div>
              </div>  
              </div>
             
            </li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "wait",
  data: function () {
    return {
      dailist: [],
      daiyingList: [],
    };
  },
  mounted() {
    axios
      .get(
        "/ajax/mostExpected?ci=30&limit=10&offset=0&token=&optimus_uuid=7640BB60D4F211EBB71879B806D5721D35A48A02F91B455A8B7208E7EC164861&optimus_risk_level=71&optimus_code=10"
      )
      .then((res) => {
        // console.log(res);
        this.dailist = res.data.coming;
        console.log(this.dailist);
        this.dailist.forEach((item) => {
          item.img = item.img.replace("w.h", "85.115");
        });
      });

      axios
      .get(
        "/ajax/comingList?ci=30&token=&limit=10&optimus_uuid=7640BB60D4F211EBB71879B806D5721D35A48A02F91B455A8B7208E7EC164861&optimus_risk_level=71&optimus_code=10"
      )
      .then((res) => {
        console.log(res);
        var daiyingList = res.data.coming;
        var daiying = {};
        daiyingList.forEach((item) => {
         item.img = item.img.replace("w.h", "64.90");
          if (daiying[item.comingTitle]) {
            daiying[item.comingTitle].push(item);
          } else {
            daiying[item.comingTitle] = [];
            daiying[item.comingTitle].push(item);
          }
        });
        this.daiyingList = daiying;
      });
  },
};
</script>

<style scoped>
.most-expected {
  padding: 12px 0 12px 15px;
  background-color: #fff;
  margin-bottom: 10px;
}
.most-expected .title {
  margin: 0;
  font-size: 14px;
  color: #333;
  margin-bottom: 12px;
}
.most-expected-list {
  width: 100%;
  display: flex;
  overflow: scroll;
  white-space: nowrap;
  margin-left: -10px;
}
.poster {
  position: relative;
  background: gray;
  margin-left: 10px;
}
.poster>img{
     width: 85px;
    height: 115px;
}
.wish-num {
  position: absolute;
  left: 3px;
  bottom: 7px;
  color: #faaf00;
  font-size: 12px;
  font-weight: 700;
}
.name{
    width: 85px;
  margin-left: 10px;
}
.date {
  margin-left: 10px;
}
.line-ellipsis {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.vv{
    padding: 10px;
    font-size: 14px;
    color: #333;
}
.vv_one{
    width: 100%;
    /* margin-left: 10px; */
    padding-bottom: 10px;
    padding-left: 10px;
    background-color: #fff;
    display: flex;
}
.vv_two{
    width: 20%;
}
.vv_three{
    width: 55%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    font-size: 17px;
    color: #333;
    font-weight: 700;
}
.vv_three p:nth-of-type(1){
    width: 203px;
}
.vv_three p:nth-of-type(2){
    color: #faaf00;
    font-size: 15px;
    font-weight: 600;
    
}
.vv_three p:nth-of-type(2)>span{
    font-size: 13px;
    color: #666;
    font-weight: 200;
}
.vv_four{
    width: 203px;
     font-size: 13px;
    color: #666;
    font-weight: 300;
}
.vv_five{
    font-size: 13px;
    color: #666;
    font-weight: 300;
    
}
.right {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 20%;
}
.active1 {
  width: 47px;
  height: 27px;
  line-height: 27px;
  text-align: center;
  color: #fff;
  background: #3c9fe6;
}
.active {
  width: 47px;
  height: 27px;
  line-height: 27px;
  text-align: center;
  color: #fff;
  background: #faaf00;;
}

</style>